﻿<%
Class qingtian_class   
               
	'================================================
	'函数名：RunStr
	'作  用：随机字符
	'================================================
	Function Formatsid(ByVal xsidy)
		Formatsid=md5(xsidy) & md5(strReverse(xsidy))
	End Function
 	Function WAPurl()'获取当前路径,用于返回
		dim url
		url=request.ServerVariables("SCRIPT_NAME") 
		if(len(trim(request.ServerVariables("QUERY_STRING")))>0) then 
		url=url & "?" & request.ServerVariables("QUERY_STRING")
		url=replace(url,"&","@@")
		end if 
		wapurl=url
	End Function              
    	Public Function strTop()
		dim Rs_info,Sql_info
if v=1 then
we0="<br/>"
else
we="<div class=""footer"">"
we0="</div>"
end if
		Set Rs_info = Server.CreateObject("Adodb.Recordset")
		Sql_info = "SELECT count(id) as [id]  FROM [qingtian_info] WHERE tid=(select top 1 id from qingtian_user where id="&myid&") and ok=1 and isok=1"
		Rs_info.Open Sql_info,conn,1,1

			if rs_info("id")>0 then
				if instr(wapurl,"urls")>0 then
				response.write ""&we&"<img src=""/img/info.gif"" alt='' noselect = ""true"" /><a href='/user/ininfo.asp?sid="&sidd&"&amp;urls="&Request.QueryString("urls")&"'>你有("&rs_info("id")&")条新消息</a>"&we0&""
				else
				response.write ""&we&"<img src=""/img/info.gif"" alt='' noselect = ""true"" /><a href='/user/ininfo.asp?sid="&code&"-"&v&"-1&amp;urls="&wapurl&"'>你有("&rs_info("id")&")条新消息</a>"&we0&""
				end if
			End if
		Rs_info.close
		set rs_info=nothing
    End Function
    '**********************************************************************************    
	'函数名称：gettotal
    '参  数：table-表明,Condition-条件
	'函数作用：取得总数据
    '**********************************************************************************
Public Function ul()
		ul=request.ServerVariables("Server_NAME")
                ul=Replace(ul, ".", "")
                ul=Replace(ul, "-", "")
End Function
    '**********************************************************************************    
	'函数名称：getsql(Table,Getkey,Condition)
	'参数名称：table--执行表,Getkey--取得字段,Condition--条件
	'函数作用：执行sql语句
    '**********************************************************************************    


     Public Function MsgConfig(FromID,CuTxt)
        dim name,tid,strr,rs,sql
        strr=str
        name=left(strr,15)&"....."
	Set Rs = Server.CreateObject("Adodb.Recordset")
	Sql = "select  [name],[title],[ok],[isok],[system],[tid],[nid] from [qingtian_info]"
	Rs.Open Sql,conn,1,3
	rs.addnew
	rs("name")=name
	rs("title")=strr
	rs("tid")=FromID
	rs("nid")=0
	rs("ok")=1
	rs("isok")=1
	rs("system")=1
	rs.update
	Rs.close
	set rs=nothing
     End Function

    Public Function Login(SID,Str)
    set Rs=server.CreateObject("adodb.recordset")
    Rs.open "select * from [qingtian_user] where id="&SID&"",conn,1,1
    if Rs.eof or Rs.bof then
    Login=False
    Else
    Login=Rs(Str)
    End if
    Rs.close
    set Rs=nothing                '关闭对象
    End Function

    Public Function bi()
			bi="魔豆"
    End Function

    Public Function money()
    money=Login(myid,"money")
    End Function

    Public Function nid()
	dim rs
	Set rs =conn.execute("select top 1 [id] from [qingtian_user] where sid='"&Formatsid(cc)&"'")
	if not (rs.bof and rs.eof) then
		nid=rs("id")
	else
		nid=0
	end if
	Rs.close
	set rs=nothing
    End Function

    Public Function togin()
    if nid=0 then
    togin=false
    else
    togin=true
    end if
    End Function

    Public Function name(ByVal nid)
    dim namet
    namet=Login(nid,"Name")
    if namet=false then
    name="游客"
    else
    name=namet
    end if
    End Function

    Public Function onl(ByVal nid)
    End Function


    Public Function pay(str,str1)
        dim strr,strr1,rs,sql
        strr=str
        strr1=str1
	Set Rs = Server.CreateObject("Adodb.Recordset")
	Sql = "select top 1 money from qingtian_user where Id="&strr1&""
	Rs.Open Sql,conn,1,3
if rs("money")+strr < 0 then
rs("money")=0
else
	rs("money")=rs("money")+strr
end if
	rs.update
	Rs.close
	set rs=nothing
    End Function
    Public Function payy(str)
        dim strr,rs,sql
        strr=str
	Set Rs = Server.CreateObject("Adodb.Recordset")
	Sql = "select top 1 money from qingtian_user where id="&myid&""
	Rs.Open Sql,conn,1,3
if rs("money")+strr < 0 then
rs("money")=0
else
	rs("money")=rs("money")+strr
end if
	rs.update
	Rs.close
	set rs=nothing
    End Function
    	Public Function RunStr()
		dim str,i
		str=year(Now()) & month(now()) & day(now()) & hour(now()) & minute(now()) & second(now())
		for i=1 to 5
		randomize
		str=str&int((9)*rnd+1)
		Next
		RunStr=str
    	End Function

   	Public Function UTF8(ByVal Str)

        If Str = "" Or IsNull(Str) Then
            utf8 = Str

            Exit Function
        End If

        str = Replace(str, "&", "&amp;")
        str = Replace(str, "<", "&lt;")
        str = Replace(str, ">", "&gt;")
        str = Replace(str, "[br]", "<br/>")
        str = Replace(str, Chr(34), "&quot;")             '双引号
        str = Replace(str, Chr(39), "&#39;")
	str = replace(str,"","")              '单引号
	str = replace(str,"","")
	str = replace(str,"^","")
	str = replace(str,"","")
	str = replace(str," ","")
	str = replace(str,"Λ","")
	str = replace(str,"Ψ","")
	str = replace(str,"","")
        str = Replace(str, "$", "$$")
        str = Replace(str, Chr(32)&Chr(10), "<br/>")
        str = Replace(str, vbNewLine, "<br/>")
        str = Replace(str, "&amp;nbsp;", "&nbsp;")
        str = Replace(str, "&amp;lt;", "&lt;")
        str = Replace(str, "&amp;gt;", "&gt;")
        str = Replace(str, "&amp;quot;", "&quot;")             '双引号
        str = Replace(str, "&amp;#39;", "&#39;")              '单引号

	utf8=str
    	End Function

    Public Function err(str)
        dim strr
        strr=str
Response.Write("出错了!"&strr&"<br/>")
Response.Write("<anchor>返回来源页<prev /></anchor><br/>")
Response.Write("</p></card></wml>") 
conn=close
liao=close
set conn=nothing
set liao=nothing
Response.end
    End Function
    Public Function shuchu()
if ve=0 then
%>
[<a href="/index.asp?sid=<%=cc%>-1-a-1&amp;ve=<%=ve%>">网站首页</a>]
</p>
</card>
</wml> 
<%
else
%>
<div><%=dao%>[<a href="/index.asp?sid=<%=cc%>-1-a-1&amp;ve=<%=ve%>">网站首页</a>]<%=we0%>
</body>
</html>
<%
end if
response.write("<!--晴天3G建站系统-wap.qt3g.com-->")
conn=close
liao=close
set conn=nothing
set liao=nothing
Response.Flush
    End Function
    Public Function admintk(Str)
    set Rs=server.CreateObject("adodb.recordset")
    Rs.open "select * from [admin]",liao,1,1
    if Rs.eof or Rs.bof then
    admintk=False
    Else
    admintk=Rs(Str)
    End if
    Rs.close
    set Rs=nothing                '关闭对象
    End Function
end class
%>